<?php /*a:3:{s:55:"/www/wwwroot/ams/app/index/view/user/user_password.html";i:1588827930;s:50:"/www/wwwroot/ams/app/index/view/public/header.html";i:1588821168;s:50:"/www/wwwroot/ams/app/index/view/public/footer.html";i:1588491103;}*/ ?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8" />
    <link rel="apple-touch-icon" sizes="76x76" href="/static/index/moban/assets/img/apple-icon.png">
    <link rel="icon" type="image/png" href="/static/index/moban/assets/img/favicon.png">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <title>首页 | <?php echo htmlentities($system_name); ?></title>
    <meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no'
        name='viewport' />
    <link href="/static/index/moban/assets/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/static/index/moban/assets/css/now-ui-kit.css?v=1.1.0" rel="stylesheet" />
</head>

<body class="index-page sidebar-collapse">

    <!-- 引入导航栏 -->
    <nav class="navbar navbar-expand-lg bg-info fixed-top">
    <div class="container">
        <div class="navbar-translate">
            <div class="navbar-brand text-white" style="font-size: 22px;"><?php echo htmlentities($system_name); ?></div>
            <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse"
                data-target="#example-navbar-info" aria-controls="navbarSupportedContent" aria-expanded="false"
                aria-label="Toggle navigation">
                <span class="navbar-toggler-bar bar1"></span>
                <span class="navbar-toggler-bar bar2"></span>
                <span class="navbar-toggler-bar bar3"></span>
            </button>
        </div>

        <div class="collapse navbar-collapse justify-content-end has-image" id="example-navbar-info">
            <ul class="navbar-nav">
                <li class="nav-item" style="float: right;">
                    <a class="nav-link" href="<?php echo url('index/index'); ?>">
                        <p style="font-size: 16px;">首页</p>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('index/notice_list'); ?>">
                        <p style="font-size: 16px;">更多资讯</p>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('index/link'); ?>">
                        <p style="font-size: 16px;">友情链接</p>
                    </a>
                </li>
                <?php if($user_info): ?>
                <li class="nav-item active">
                    <a class="nav-link" href="<?php echo url('User/index'); ?>">
                        <p><?php echo htmlentities($user_info->name); ?></p>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('Login/logout'); ?>">
                        <p>退出</p>
                    </a>
                </li>
                <?php else: if($registered): ?>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('Login/index'); ?>">
                        <p>登录</p>
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('Login/register'); ?>">
                        <p>注册</p>
                    </a>
                </li>
                <?php else: ?>
                <li class="nav-item">
                    <a class="nav-link" href="<?php echo url('Login/index'); ?>">
                        <p>登录</p>
                    </a>
                </li>
                <?php endif; ?>
                <?php endif; ?>
            </ul>
        </div>
    </div>
</nav>
<!-- 向下推65像素 -->
<div style="height: 65px;"></div>

<!-- 防止闪屏 -->
<script src="/static/index/moban/assets/js/plugins/jquery.sharrre.js" type="text/javascript"></script>
<!-- Code JS File -->
<script src="/static/index/moban/assets/js/core/jquery.3.2.1.min.js" type="text/javascript"></script>
<script src="/static/index/moban/assets/js/core/popper.min.js" type="text/javascript"></script>
<script src="/static/index/moban/assets/js/core/bootstrap.min.js" type="text/javascript"></script>

<!-- 弹出层 -->
<script src="/static/admin/lib/layer/layer.js"></script>

<!-- 模板动作 -->
<script src="/static/index/moban/assets/js/now-ui-kit.js?v=1.1.0" type="text/javascript"></script>
<script type="text/javascript">
    $(document).ready(function () {
        // the body of this function is in assets/js/now-ui-kit.js
        nowuiKit.initSliders();
    });

    function scrollToDownload() {

        if ($('.section-download').length != 0) {
            $("html, body").animate({
                scrollTop: $('.section-download').offset().top
            }, 1000);
        }
    }
</script>

    <div class="container" style="min-height: 410px;">
        <div class="row" style="margin-top: 80px;">
            <!-- 昵称 年龄 Start -->
            <div class="col-md-2"></div>
            <div class="col-md-8">
                <div class="input-group">
                    <span class="input-group-addon">
                        旧密码
                    </span>
                    <input id="old_password" type="password" class="form-control" placeholder="请输入旧密码">
                </div>
            </div>
            <div class="col-md-2"></div>
            <div class="col-md-2"></div>
            <div class="col-md-8">
                <div class="input-group">
                    <span class="input-group-addon">
                        新密码
                    </span>
                    <input id="new_password" type="password" class="form-control" placeholder="请输入新密码">
                </div>
            </div>
            <div class="col-md-2"></div>
            <div class="col-md-2"></div>
            <div class="col-md-8">
                <div class="input-group">
                    <span class="input-group-addon">
                        确认密码
                    </span>
                    <input id="confirm_password" type="password" class="form-control" placeholder="请输入确认密码">
                </div>
            </div>
            <div class="col-md-2"></div>
            <!-- 昵称 年龄 End -->

            <div class="col-md-6" style="text-align: center;">
                <button id="save" class="btn btn-success btn-round btn-lg">点击修改</button>
            </div>
            <div class="col-md-6" style="text-align: center;">
                <button id="back" class="btn btn-info btn-round btn-lg">点击返回</button>
            </div>

        </div>
    </div>
    <!-- 引入页脚 -->
    <footer class="footer " style="background-color: #ddd;">
    <div style="text-align: center;">
        Copyright © 2020 夏立军 山东建筑大学-成果管理系统 201611106025
    </div>
</footer>

    <script>

        // 点击保存
        $('#save').on('click', function () {
            // 收集数据
            var uid = "<?php echo htmlentities($user_id); ?>";
            var old_password = $('#old_password').val().trim();
            var new_password = $('#new_password').val().trim();
            var confirm_password = $('#confirm_password').val().trim();

            if (old_password == '') {
                return layer.msg('旧密码不能为空', { icon: 2, time: 900 });
            }
            if (new_password == '') {
                return layer.msg('新密码不能为空', { icon: 2, time: 900 });
            }
            if (confirm_password == '') {
                return layer.msg('确认密码不能为空', { icon: 2, time: 900 });
            }
            if (new_password.length < 6) {
                return layer.msg('密码成都不能少于6位', { icon: 2, time: 900 });
            }
            if (new_password != confirm_password) {
                return layer.msg('两次密码不一致', { icon: 2, time: 900 });
            }

            var data = {
                'uid': uid,
                'old_password': old_password,
                'new_password': new_password,
                'confirm_password': confirm_password,
            };

            $.ajax({
                url: "<?php echo url('User/user_password'); ?>",
                data: data,
                type: "POST",
                dataType: "JSON",
                success: function (res) {
                    // 返回结果处理
                    if (res.code == 0) {
                        return layer.msg(res.msg, { icon: 1, time: 900 },function(){
                            $('#old_password').val('');
                            $('#new_password').val('');
                            $('#confirm_password').val('');
                        });
                    } else {
                        return layer.msg(res.msg, { icon: 2, time: 900 });
                    }
                }
            });
        });

        // 点击返回
        $('#back').on('click', function () {
            window.location.href = document.referrer;
        });

    </script>


</body>

</html>